
import React from 'react';
import { Radio, Button, Space } from 'antd';
import { classificationExport } from '@/services/Collection';
import ExportButton from '@/components/ExportButton';

class Export extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      radioValue: 1
    }
  }

  /* 单选按钮 */
  onRadioChange = (e) => {
    const {change} = this.props;
    const value = e.target.value;
    this.setState({radioValue: value});
    change ? change(value) : null;
  }

  render() {
    const {onRadioChange, onExport} = this;
    const {query} = this.props;
    const {radioValue} = this.state;
    return (
      <Space>
        <ExportButton query={query} request={classificationExport} />
        {/* <Button type='primary' style={{marginRight: 20}} loading={isExport} onClick={onExport}>导出</Button> */}
        <Radio.Group value={radioValue} onChange={onRadioChange}>
          <Radio value={1}>五大类</Radio>
          <Radio value={0}>22大类</Radio>
        </Radio.Group>
      </Space>
    )
  }
}

export default Export